def solution(n: int, A: int, B: int, array_a: list) -> int:
    assert A <= 9 and B <= 9
    assert n == len(array_a)

    MOD = 10000007
    dp = [[0 for _ in range(10)] for _ in range(n + 1)]

    sum_value = sum(array_a) % 10
    ret = (A + B) % 10
    res = 0

    if sum_value == B:
        res += 1

    dp[0][0] = 1
    if sum_value == ret:
        for i in range(1, n + 1):
            for j in range(10):
                dp[i][j] = (dp[i - 1][j] + dp[i - 1][(j - array_a[i - 1]) % 10]) % MOD
        return (dp[n][A] + res) % MOD
    else:
        if sum_value == A:
            res += 1
        return res



if __name__ == "__main__":
    #  You can add more test cases here
    print(solution(3, 1, 2, [1,1,1]) == 3 )
    print(solution(3, 3, 5, [1,1,1]) == 1 )
    print(solution(2, 1, 1, [1,1]) == 2 )